import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '阶段标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '阶段描述',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '可得积分',
    align: "center",
    dataIndex: 'integral'
  },
  {
    title: '开始时间',
    align: "center",
    dataIndex: 'startTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '结束时间',
    align: "center",
    dataIndex: 'endTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '排序',
    align: "center",
    dataIndex: 'sort'
  },
  {
    title: '启用状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "阶段标题",
    field: 'title',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '阶段标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '阶段描述',
    field: 'description',
    component: 'Input',
  },
  {
    label: '可得积分',
    field: 'integral',
    component: 'InputNumber',
  },
  {
    label: '开始时间',
    field: 'startTime',
    component: 'DatePicker',
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
  },
  {
    label: '排序',
    field: 'sort',
    component: 'InputNumber',
  },
  {
    label: '启用状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "status"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
